﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Lon.Server
{
    public partial class LoginForm : Form
    {
        public LoginForm()
        {
            InitializeComponent();
        }

       

        public string UserName
        {
            get { return txtUserName.Text; }
            set { txtUserName.Text = value; }
        }

        public string Password
        {
            get { return txtPassword.Text; }
            set { txtPassword.Text = value; }
        }

        protected override void OnLoad(EventArgs e)
        {
          

            base.OnLoad(e);
        }

        protected override void OnClientSizeChanged(EventArgs e)
        {
            base.OnClientSizeChanged(e);
        }

        private void txtUserName_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Return)
            {
                txtPassword.Focus();
            }
        }

        private void txtPassword_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Return)
            {
                btnOK.PerformClick();
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            Close();
        }
    }

    public class LoginMan
    {
        static LoginMan instance = null;
        public static LoginMan Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new LoginMan();
                }
                return instance;
            }
        }

        public LoginMan()
        {
            LoginUser = "未知用户";
            LoginPrivilege = PrivilegeType.NONE;
            LoginSuccess = false;
        }

        public bool LoginSuccess
        {
            get;
            set;
        }

        public string LoginUser
        {
            get;
            set;
        }

        public PrivilegeType LoginPrivilege
        {
            get;
            set;
        }
    }
}
